#ifndef SCENE_HEADER_VIZMF_PROJECT
#define SCENE_HEADER_VIZMF_PROJECT

#include <list>

#include "sceneelement.h"
#include "pointer_iterator.h"
#include "material.h"
#include "camera.h"

class Scene
{
public:
  typedef std::list<SceneElement*> element_list;
  typedef element_list::iterator element_iterator;
  typedef element_list::const_iterator element_const_iterator;
  
  Scene() : cam(Camera(Vector3(0.0, 0.0, 0.0), 1)) {}
  ~Scene()
  {
    for(element_list::iterator i = elements.begin(), ie = elements.end(); i != ie; ++i) delete *i;
    for(element_list::iterator i = selection.begin(), ie = selection.end(); i != ie; ++i) delete *i;
  }

  const Camera& camera() const {return cam; }
  Camera& camera() { return cam; }
  
  const Material& backgroundColor() const { return bgc; }
  void setBackgroundColor(const Material& m ) { bgc = m; }
  
  void addElement(SceneElement* e) { elements.push_back(e);}
  void addSelectionElement(SceneElement* e) { selection.push_back(e);}
  element_iterator elementsBegin() { return elements.begin(); }
  element_const_iterator elementsBegin() const { return elements.begin(); }
  element_iterator elementsEnd() { return elements.end(); }
  element_const_iterator elementsEnd() const { return elements.end(); }
  element_iterator selectionBegin() { return selection.begin(); }
  element_const_iterator selectionBegin() const { return selection.begin(); }
  element_iterator selectionEnd() { return selection.end(); }
  element_const_iterator selectionEnd() const { return selection.end(); }

private:
  element_list elements;
  element_list selection;
  Camera cam;
  Material bgc;
};

#endif // SCENE_HEADER_VIZMF_PROJECT
